package com.libing.dao;

import com.libing.base.BaseDao;
import com.libing.entity.Customer;
import com.libing.entity.CustomerLevel;
import com.libing.web.vo.CustomerVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Description: 客户信息 DAO
 * @Auther: LEE
 * @Date: Create in 2018/2/6 23:05
 */
@Component
public interface CustomerDao extends BaseDao<Customer> {

    /**
     * TODO 根据参数查询客户
     * @param name
     * @param contact
     * @return
     */
    List<CustomerVO> findCustomersByParams(@Param("name") String name, @Param("contact") String contact, @Param("companyName") String companyName, @Param("minScore") Integer minScore, @Param("maxScore") Integer maxScore);

    /**
     * 根据级别ID获取客户级别信息
     *
     * @param levelId
     * @return
     */
    List<CustomerLevel> queryCustomerLevel(@Param("levelId") Long levelId);

    /**
     * 根据客户ID获取客户详细信息
     * @param id
     * @return
     */
    Customer queryCustomerById(@Param("id") Integer id);

    /**
     * 插入数据并为实体类对象设置数据库主键
     * @param customer
     * @return
     */
    int insertAndGetId(Customer customer);

    /**
     * 插入客户等级
     * @param customerLevel
     * @return
     */
    int insertCusLevel(CustomerLevel customerLevel);

    int updateCusLevel(CustomerLevel customerLevel);

    int deleteCusLevel(Integer id);

}
